home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / f1gplib352.lha / f1gplib_35.2 / test.c < prev   
C/C++ Source or Header  |  1995-10-06  |  2KB  |  54 lines

  1. /*******************************************************************
  2. ** Simple example of using "f1gp.library"
  3. */
  4. #include <exec/types.h>
  5. #include <proto/exec.h>
  6. #include <proto/f1gp.h>
  7. #include <libraries/f1gp.h>
  8.  
  9. #include <stdlib.h>
  10. #include <stdio.h>
  11.  
  12. struct F1GPBase *F1GPBase = NULL;
  13.  
  14. ULONG Sig_f1gpquit = 0;
  15.  BYTE f1gpquit_SigBit;
  16.  
  17. int main(int argc, char **argv)
  18. {
  19.    APTR quithandle;
  20.    int i;
  21.  
  22.    if (F1GPBase = (struct F1GPBase *)OpenLibrary("f1gp.library",0)) {
  23.       /**** INIT ****/
  24.       f1gpquit_SigBit = AllocSignal(-1);
  25.       Sig_f1gpquit = 1L << f1gpquit_SigBit;
  26.       quithandle = f1gpAllocQuitNotify(FindTask(NULL),Sig_f1gpquit);
  27.       /**************/
  28.  
  29.       if (f1gpDetect()) {    // IMPORTANT: A f1gpDetect() call will
  30.                             // patch the F1GP quit routines if needed.
  31.  
  32.          for (i=0;i<4;i++) printf("Hunk %d: 0x%08x\n",i,F1GPBase->HunkStart[i]);
  33.  
  34.          printf("F1GP version: %d (see libraries/f1gp.h)\n",F1GPBase->F1GPType);
  35.          printf("Waiting until F1GP quits...\n");
  36.          Wait(Sig_f1gpquit);    // Wait until F1GP quits
  37.          printf("F1GP has quitted - bye\n");
  38.       }
  39.       else {
  40.          printf("F1GP not in memory - won't bother to wait, bye...\n");
  41.       }
  42.  
  43.       /**** SHUTDOWN ****/
  44.       f1gpFreeQuitNotify(quithandle);
  45.       if (f1gpquit_SigBit != -1) FreeSignal(f1gpquit_SigBit);
  46.       CloseLibrary((struct Library *)F1GPBase);
  47.       /******************/
  48.    }
  49.    else {
  50.       printf("Unable to open f1gp.library\n");
  51.    }
  52.    return(0);
  53. }
  54.